﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace GameOver
{
    class Program
    {
        static Random next = new Random();
        static void Main(string[] args)
        {
            //Console.BufferHeight = Console.WindowHeight = 60;
            //Console.BufferWidth = Console.BufferWidth = 20;

            int n = 7;
            // printing g
            PrintG(n);
            // printing a
            PrintA(n);
            // printing m
            PrintM(n);
            // printing e
            PrintE(n);
            Console.WriteLine();
            Console.WriteLine();            
            // printing o
            PrintO(n);
            // printing v
            PrintV(n);
            // printing e
            PrintE(n);
            // printing r
            PrintR(n);

        }
        static void PrintG(int n)
        {
            string[,] matrix = new string[n, (n - 2)];

            for (int row = 0; row < matrix.GetLength(0); row++)
            {
                for (int col = 0; col < matrix.GetLength(1); col++)
                {
                    if (((row == 0 || row == matrix.GetLength(0) - 1) && (col >= 1 && col < matrix.GetLength(1) - 2)) ||
                     (col == 0 && row > 0 && row < matrix.GetLength(0) - 1) ||
                     (col == matrix.GetLength(1) - 1 && row == 1) ||
                     ((row > (n / 2) && row < matrix.GetLength(0) - 1 && col == matrix.GetLength(1) - 1)) || (row == n / 2 && col > (n - 2) / 2 && col < matrix.GetLength(1) - 1))
                    {
                        int num = next.Next(0, 10);
                        Console.Write(num);
                    }
                    else
                    {
                        Console.Write(" ");
                    }

                }
                Console.WriteLine();
            }
            Console.WriteLine();
        }
        static void PrintA(int n)
        {
            string[,] matrix = new string[n, (n - 2)];

            for (int row = 0; row < matrix.GetLength(0); row++)
            {
                for (int col = 0; col < matrix.GetLength(1); col++)
                {
                    if (row + col == (n - 2) / 2 || col - row == (n - 2) / 2 || (col == 0 && row >= n / 2) || (col == matrix.GetLength(1) - 1 && row >= n / 2) || row == n / 2)
                    {
                        int num = next.Next(0, 10);
                        Console.Write(num);
                    }
                    else
                    {
                        Console.Write(" ");
                    }

                }
                Console.WriteLine();
            }
            Console.WriteLine();
        }
        static void PrintM(int n)
        {
            string[,] matrix = new string[n, (n - 2)];

            for (int row = 0; row < matrix.GetLength(0); row++)
            {
                for (int col = 0; col < matrix.GetLength(1); col++)
                {
                    if ((col == 0 || col == matrix.GetLength(1) - 1) || ((row >= 1 && row <= (n - 2) / 2) && (row - col == 0 || row + col == n-3)) || (row == n / 2 && col == (n - 2) / 2))
                    {
                        int num = next.Next(0, 10);
                        Console.Write(num);
                    }
                    else
                    {
                        Console.Write(" ");
                    }

                }
                Console.WriteLine();
            }
            Console.WriteLine();

        }
        static void PrintE(int n)
        {

            string[,] matrix = new string[n, (n - 2)];

            for (int row = 0; row < matrix.GetLength(0); row++)
            {
                for (int col = 0; col < matrix.GetLength(1); col++)
                {
                    if (row == 0 || row == n / 2 || row == n - 1)
                    {
                        int num = next.Next(0, 10);
                        Console.Write(num);
                    }
                    else
                    {
                        Console.Write(" ");
                    }

                }
                Console.WriteLine();
            }
            Console.WriteLine();
        }
        static void PrintO(int n)
        {
            string[,] matrix = new string[n, (n - 2)];

            for (int row = 0; row < matrix.GetLength(0); row++)
            {
                for (int col = 0; col < matrix.GetLength(1); col++)
                {
                    if (row + col == (n - 2) / 2 || col - row == (n - 2) / 2 || (col == 0 && row >= n / 2 && row <= n- (n/2)) || (col == matrix.GetLength(1) - 1 && row >= n / 2 && row<= (n-n/2))       ||
                        (row >n/2+1 && row - col == n/2 +1 || row + col == n -1+ (n-2)/2 ))
                    {
                        int num = next.Next(0, 10);
                        Console.Write(num);
                    }
                    else
                    {
                        Console.Write(" ");
                    }

                }
                Console.WriteLine();
            }
            Console.WriteLine();

        }
        static void PrintV(int n)
        {
            string[,] matrix = new string[n, (n - 2)];

            for (int row = 0; row < matrix.GetLength(0); row++)
            {
                for (int col = 0; col < matrix.GetLength(1); col++)
                {
                    if (((col==0 || col == matrix.GetLength(1) -1) && row <=n/2+1) ||
                        (row > n / 2 + 1 && row - col == n / 2 + 1 ) || row + col == n - 1 + (n - 2) / 2)
                    {
                        int num = next.Next(0, 10);
                        Console.Write(num);
                    }
                    else
                    {
                        Console.Write(" ");
                    }

                }
                Console.WriteLine();
            }
            Console.WriteLine();

        }
        static void PrintR(int n)
        {
            string[,] matrix = new string[n, (n - 2)];

            for (int row = 0; row < matrix.GetLength(0); row++)
            {
                for (int col = 0; col < matrix.GetLength(1); col++)
                {
                    if (col==0|| ((row== 0 ||row==n/2) && col<matrix.GetLength(1)-1 )||(col == matrix.GetLength(1)-1 && row>=1 && row<n/2 ) ||(row >n/2 && col >=(n-2)/2 && row-col ==2))
                    {
                        int num = next.Next(0, 10);
                        Console.Write(num);
                    }
                    else
                    {
                        Console.Write(" ");
                    }

                }
                Console.WriteLine();
            }
            Console.WriteLine();

        }
    }
}
